Cropping examples
The cropping examples are designed to help you set up crops in your simulation, whether using single crop, mixed crops or rotation cropping. These examples also show how to perform value adding to a crop product before selling using tomato paste as an example and include use of labour for activities. These simulations are provided in the CLEM_example_cropping simulation file. You can use these example descriptions as a walk-through tutorial for setting up and exploring the outcomes of your own simulation.
Values used in examples are purely fictitious and are only intended as representative values in the example. Some figures may not be realistic.

The simplest form of growing crops on a farm is a single crop allocated to a piece of the land available. This example also includes a mixed crop of vegetables.
This example introduces:
- Crop data readers to read production input data
- Labour provided for performing tasks
- Single crop and mixed cropping
- Processing a resource (value adding)
- Selling resources

A Crop data reader (named FileCrop_Maize) is used to read the file of maize harvests (space delimited APSIM crop output file name FileCrop_Maize.prn)
A Crop data reader (named FileCrop_Vegetables) is used to read the file of all vegetable (tomato and cucumber) production (space delimited APSIM crop output file name FileCrop_Vegetables.prn)

In this example we need Land on which to grow a crop. The Land specifies that we are using hectares as units and contains one Land type with an area of 2 hectares and a land type id of 4, which links to the land type id column of the Data reader (named SoilNum from input file). The values in the input file match the value for the land type so we can grow Maize on the land provided.
We include a Finance resource with a Finance type named General account in from which to perform all financial transactions.
In this example Labour is provided to perform the harvest of the maize crop. Separate Male and Female Labour types are provided with a Labour availability list providing the days per month for each labour type as Labour availability items.
Finally, we need somewhere to store our crops when harvested. In this example we are not feeding animals (Animal food store) or people (Human food store) so we can use the Product store to track our crop products. A Product store type is provided for each resource including one for the tomato paste that is produced on the farm. You can see that both Maize and TomatoPaste contain a Resource pricing to provide the price and units of trade. You can see that maize is sold in 1000 kg (1 tonne) units worth 100 dollars a tonne. Tomato past is sold in 500g (0.5 kg) units and can only be sold as whole packets worth $2.50 each. There is only a sale price so the model cannot purchase tomato paste.

The Manage crop activity (named Manage maize) is provided under the Activities holder and allocates the required land (1 hectare) if available. Below this activity is a Manage crop product activity (named Grow maize) that is responsible for managing the production of the maize at harvest (does not require a harvest timer as it is assumed) and is therefore provided a Category for Transactions property (Harvest) so its actions are grouped with other harvests in the reports. This activity contains a Labour requirement that states that 5 days labour is required for each (Number of units = 1) hectare (Units to use = perHa) harvested and this harvest is to be undertaken by males (Labour group named Male with a child Filter by property Gender = Male). If there is not enough Male labour available then females will be assigned as dictated by the nested Labour group named Female.
Below the Manage Maize activity is a Sell resource activity named Sell Maize that sells all maize (Selling style = ProportionOfStore, Value for selling style = 1 or affectively 100%) from the ProductFoodStore.Maize with financial transactions using Finances.General account. As there is no timer associated with this activity (would be provided below), it will be performed each month and only performed (status = success) if maize is present in the store. There is no labour required by this activity. The price of maize is determined by the price provided in the resource section.
The next Manage crop activity (named Manage Vegetables) assigned the land needed (0.8 ha) to grow vegetables, just like Manage Maize above, only in this activity there are two crop products that actually relate to two different crops grown together. This is achieved by placing the second Manage crop product (named Grow cucumbers) below the first (named Grow tomatoes). The same process is used to get the crop production from the related Crop data reader (named FileCrop_Vegetables) that contains production data for both crops. Both tomatoes and cucumbers have the Proportion of product kept set to 0.8. This means only 80% of the production provided in the input file will be collected. This allows us to reduce production from a single crop value as the result of growing the two crops together. Alternatively, you could ensure the input data already accounts for mixed crop conditions (such as modelled or field measurements), in which case Proportion of product kept set to 1.
All activities relating to making tomato paste are contained in the Tomato Paste Activity folder. A Process resource activity (named Make tomato paste) is used to convert ProductStore.Tomatoes to ProductStore.TomatoPaste where 100 g (0.1 kg) of tomato paste is created from every unit (kg) of tomatoes processed. This activity uses the pricing details for tomato paste in the resources that states that a unit of tomato paste is 500 g (0.5 kg) and sells for $2.50. This activity also contains a Resource activity fee (named Buy jars) that pays 20 c (0.2 dollars) for every kg of tomatoes processed (5 kg x .2 = $1 per 5 kg x .1 500 g past produced, or one jar per 500 g paste), as one jar is required per unit paste made. The Make tomato paste activity also requires labour. In this case 5 days labour is required for every unit (per unit) where one unit is 1000 kg of tomatoes processed and this can only be performed by females (as provided in the Labour requirement). A Sell resource activity (named Sell tomato paste) is provided to sell whatever is in the store (Selling style = Proportion of store, Value = 1). As this activity is provided after the Process resource activity activity we can be reassured that the production of tomato paste is always performed before trying to sell tomato paste. An Interval timer is provided that only allows selling of tomato paste in November each year. This example does not use any reduction in the creation of tomato paste as a result of resource shortfalls (money for jars or labour). NOTE: all calculations in this process resource activity are based on the resource processed, not the resource created.

The reports provided with the example provide the model output needed. We can learn a lot about the simulation by looking through the reports and even note where things may not have gone as expected.

The Activities performed report provides a graphical display of the status of all activities during your simulation. A lot of information can be gained from displaying this report in the user interface or opened in a web browser in a separate window. We can learn the following about our simulation:
- Manage Maize and Manage vegetables are place holder activities with nothing specific to do each month but manage their child components so do not have a symbol displayed.
- We are able to see that the various crops are harvested in different months. The Manage crop product activities are performed every month as seen from the green or grey tick in every column. The columns with a green check mark indicate where a harvest took place. You can check that the harvest months correspond to your input data. Tomatoes are even harvested across multiple months.
- We can also see that the Sell Maize activity is performed every month, but only has something to do (sell maize) in the months where maize is harvested. If we look at the Sell tomato paste activity we see that the November sales Interval timer that only occurs in November each year is limiting when the Sell tomato paste activity is performed. Activities that are not performed because their timer was not active will display with a blank column.

The Labour requirements report provides a graphical display of where all labour was allocated in the simulation. Note, this is how labour is allocated and not the actual use of labour in the simulation.
- Two types of labour are provided in the simulation (named Male and Female) and six of the activities performed accept Labour requirements.
- The Sell Maize and Sell Tomato paste activities (Sell resource activity) are able to accept Labour requirement but none have been assigned in this simulation.
- Male labour is preferred for growing maize, but if insufficient, Female labour will be used. The opposite is true for growing tomatoes and making tomato paste.
- Only Female labour is possible for growing cucumbers.
The next three reports provide all transactions for Products, Finances and Labour. We will consider what we can determine from each

The automated CLEM Resource ledger report for the Products store provides every transaction that occurred during the simulation. Click on this report component. In the Properties tab you will see that only our ProductStore is set for reporting. Next click the Data tab to see what transactions were produced.
- You can see all the entries providing gains (resource came into the store) coming from the harvest activities (Grow maize crop, Grow cucumbers and Grow tomatoes) as well as the Process tomato paste activity that produces a gain for Tomato paste and a loss for the Tomatoes store as expected.
- Losses from the store were also produced by the two sell activities
- Loss converted to value (price in Price_Loss column) is also included. No Price_gain column was added as there were no purchase pricing provided.

The automated CLEM Resource ledger report for the Finances store provides every transaction that occurred during the simulation. Click the Data tab to see what transactions were produced.
- The ledger starts with the initial bank balance of $100
- All gains to the bank account come from the various sales of maize and tomato paste.
- Losses (or expenses) come form the months where jars are purchased for making tomato paste.
- Loss converted to value (price in Price_Loss column) is also included. No Price_gain column was added as there were no purchase pricing provided.
- The category column uses the values provided in the simulation and allows us to group income and expenses into the various categories

The automated CLEM Resource ledger report for the Labour store provides every transaction that occurred during the simulation. Click the Data tab to see what transactions were produced.
- All transactions are losses as we can't gain labour (without buying hired labour that was not performed in this simulation.
- We can see labour transactions are categorised as Harvest or Process based on the categories supplied.
- The resource column could be used to report on labour used by type (e.g. Male and Female)
- The amount of labour used for each activity changes throughout the simulation as a result of being based on crop harvested and amount of tomato processed which are responding to the input data.

The automated CLEM Resource balances report provides balances at the end of each month for the Labour, ProductStore and Finances stores as dictated in the Properties tab. Click the Data tab to see the monthly balances.
- The labour (Male and Female columns) is the remaining days available at the end of the month. We can see that there is no shortfall of labour in our simulation requirements.
- Maize and Tomato balances are always zero as these are either sold or converted into tomato paste between the harvest and the end of the month.
- Tomato paste stores build up until sold in November each year
- The Cucumber store continues to increase. It is only now that we may realise we have a valuable resource that we have not sold during our simulation.
- The General_account column shows the bank balance. The overall increase suggests our maize and tomato paste farm is profitable. But, we also now realise we have not included any of the farm operating expenses.

The automated CLEM Resource shortfalls report provides presents every time a resource was in shortfall when requested.
- As expected from our ledger and balance reports the shortfall report is empty.
- This is a valuable report to check. The CLEM descriptive summary will also alert you when shortfalls occurred in your simulation.

A range of graphs are provided to show you how to set up APSIM graphs and present results.

Another form of cropping is where you need to rotate crops on the same piece of land is presented in this example.
This example introduces:
- Harvest tags in the Crop data readers
- Multiple harvests per planting cycle
- Rotational cropping
- Crop task activity
- Crop fees
- Selling resources
- Labour shortfalls

A Crop data reader (named FileCrop) is used to read the file containing both wheat and sorghum crop yields (space delimited APSIM crop output file name FileCrop_SorgWheat.prn).
In this example, you may notice that the Column name for harvest type is set to HarvestTag. This introduces the ability to specify the "first" and "last" harvest in a multi-harvest sequence in the harvest tag column. This means that all pre-harvest activities such as preparation and planting will only happen before first harvest, and rotation to the next crop won't happen until after the last harvest of the sequence. Any harvests provided between first and last harvest will be included in the multi-harvest sequence.

The resources used are similar to the single and mixed crop example.
In this example we need Land on which to grow the crops one at a time. The Land specifies that we are using hectares as units and contains one Land type (named Farm) with an area of 80 hectares and a land type id of 1, which links to the land type id column of the Data reader (named SoilNum from input file). The values in the input file match the value for the land type so we can grow both crops on the land provided.
We include a Finance resource with a Finance type named General account in from which to perform all financial transactions.
In this example Labour is provided to perform the various crop related tasks. Only Male Labour type is provided (with a single individual, see Number of individuals) with a Labour availability list providing the days per month for each labour type as Labour availability items.
Finally, we need somewhere to store our crops when harvested. In this example we are not feeding animals (Animal food store) or people (Human food store) so we can use the Product store to track our crop products. A Product store type is provided for each resource that is produced on the farm. You can see that both Wheat and Sorghum contain a Resource pricing to provide the price and units of trade either bought or sold. Both are priced per 1000 kg (1 tonne) units.

All activities relating to managing the crops are contained in the Manage crops Activity folder.
The Manage crop activity (named Manage rotation) is provided under the activity folder and allocates the required 80 hectares of land if available. Below this activity are two Manage crop product activity (named Manage Wheat andManage Sorghum ) that are responsible for managing the production of the wheat and sorghum respectively. Both keep 100% of the crop harvested and place the harvest resource into the respective store.
The Manage rotation activity is responsible to tracking the rotation through time using the dates of harvest that are obtained from the input file. The system will grow the first crop in the list until harvested, then moving to the next crop. This process is repeated for the duration of the simulation. The harvest dates specified in the input file ultimately dictate the rotation sequence timing.
Each Manage crop product activity contains a number of crop tasks and fees below them each with Labour requirements and Crop harvest timer if needed. These tasks and costs also provide category values to assist with summarising output. All tasks and costs related to harvesting each crop are provided in an Activity folder (named Harvest activities) allowing a single Crop harvest timer to be used for all activities in the folder.
Considering the Prepare wheat activity, we can see that the timer will try and perform this activity 11 months before the harvest date (record in the input data) and it takes 1 day of labour per 40 hectares prepared. The Weed spray wheat activity is performed from 6 months before harvest until 2 months before harvest. The Harvest wheat Crop task activity has two associated Crop fee activity a harvest cost of $40 and a variable harvest cost of $175 per hectare harvested. A similar setup is provided for Sorghum.
These crop activities are followed by two Sell resource activity. The Sell wheat activity is set to sell 1000 kg per month while available, while the Sell sorghum activity will sell everything each July, but reserve 10% of the store.

The reports provided with the example provide the model output needed. We can learn a lot about the simulation by looking through the reports and even note where things may not have gone as expected.

The Activities performed report provides a graphical display of the status of all activities during your simulation. A lot of information can be gained from displaying this report in the user interface or opened in a web browser in a separate window. We can learn the following about our simulation:
- The rotation of crops is evident in the Manage wheat and Manage sorghum timing. The period in the middle of the simulation where Manage sorghum is performed also shows that three harvests were performed in this period (HarvestTag "first", "last" and one in between)
- The report shows that thee was insufficient labour available to fully perform both of the Transport wheat activities displayed with a pie symbol
- Some activities could not be performed due to the timing of crop rotation and harvests. These activities are displayed with an exclamation icon
- The various timers used in the simulation are all displayed at the bottom of the report that allow you to confirm the timing of all activities
- You can also note that the Sell sorghum activity has nothing to do on the first two occasions as there is no sorghum in the store until the first harvest occurs.
The next three reports provide all transactions for Products, Finances and Labour. We will consider what we can determine from each

The automated CLEM Resource ledger report for the Products store provides every transaction that occurred during the simulation. Click on this report component. In the Properties tab you will see that only our ProductStore is set for reporting. Next click the Data tab to see what transactions were produced.
- The report shows all gains resulting from harvests performed by the Manage Wheat and Manage Sorghum activities
- The loss column is dominated by the monthly sale of Wheat from the store, and also includes a single Sell Sorghum transaction
- The value of all transactions is also provided.

The automated CLEM Resource ledger report for the Finances store provides every transaction that occurred during the simulation. Click the Data tab to see what transactions were produced.
- The ledger starts with the initial bank balance of $1000
- All gains to the bank account come from the various sales
- Losses (or expenses) come form the costs of harvesting wheat and sorghum
- Loss converted to value (price in Price_Loss column) is also included. No Price_gain column was added as there were no purchase pricing provided.

The automated CLEM Resource ledger report for the Labour store provides every transaction that occurred during the simulation. Click the Data tab to see what transactions were produced.
- All transactions are losses as we can't gain labour (without buying hired labour that was not performed in this simulation
- We can see labour transactions are categorised into a range of tasks for future analysis
- The resource column shows which individual "Male" of the 5 available was used for the task. Some tasks use the first individual, while others use the second individual, when the first individual has no availability
- Some tasks can be performed by a single individual (Male_1), while Transport wheat requires all five individuals to be performed

The automated CLEM Resource balances report provides balances at the end of each month for the Labour, ProductStore and Finances stores as dictated in the Properties tab. Click the Data tab to see the monthly balances.
- The labour (Male_1 to Male_5 columns) is the remaining days available at the end of the month. In most months these are 8, the value of availably monthly days we set in the Labour availability list in the Labour
- Wheat stored is 0 until the first harvest, after which is decreases by 5,000 kg sold each month
- Sorghum declines at each sale (July) with 10% of the store left as reserve
- The General_account column shows the bank balance. There is a decline from the opening balance to -2,120 in April 1905 after which the income from wheat sales increases the account

The automated CLEM Resource shortfalls report provides presents every time a resource was in shortfall when requested.
- As expected from our activity report and labour ledger the shortfall report is contains entries from the Transport wheat activity
- The entries show how much of the required resource was available indicating the severity of the shortfall. In our simulation 38 days of the required 47.16 days was provided

A range of graphs are provided to show you how to set up APSIM graphs and present results.
See also